
package com.clqteam.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.clqteam.service.SupplierService;
import com.clqteam.serviceimpl.SupplierServiceImpl;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;



import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.clqteam.service.SupplierService;
import com.clqteam.serviceimpl.SupplierServiceImpl;

import net.sf.json.JSONObject;
/**
 * 
 * @author lxg
 *
 */
public class SupplierController extends HttpServlet{
	SupplierService ss=new SupplierServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
		
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setCharacterEncoding("utf8");
		req.setCharacterEncoding("utf8");
		PrintWriter pw=resp.getWriter();
		//获取请求的page值
		String pa=req.getParameter("page");
		int page=Integer.parseInt(pa);
		//获取请求的rows值
		String row=req.getParameter("rows");
		int rows=Integer.parseInt(row);
		
		JSONObject jo=ss.selectSupplier(page, rows);
		
		pw.write(jo.toString());
		pw.flush();
		pw.close();
	}
	
}
